
<!--jquery setup-->
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<!--template setup-->
<script type="text/javascript" src="../js/menu.js">/*wag aalisin yun /sript*/</script>
<link type="text/css" rel="stylesheet"  href="../css/templatemo_style.css" />
<link type="text/css" rel="stylesheet"  href="../css/ddsmoothmenu.css" />

<script type="text/javascript" src="../js/jquery-ui-1.9.2.custom.js"></script>
<link rel="stylesheet" type="text/css" href="../css/jquery-ui-1.9.2.custom.css"/>

<script language="javascript" type="text/javascript">
var loader = '<div style="padding:10px; margin:auto"><img src="../images/loading.gif" alt="Please Wait"/>loading.....</div>';
 $(document).ready(function() {
    
	$("#itemList").html(loader).load("../shop/cartList.php");
	$("#login").click(function (){
		$("#msgbox2").dialog({
			title:"Login",
			modal:true,
			width: 310,
			height: 170,
			show: "fade",
			hide: "fade",
			
		});
		$("#msgbox2").html(loader).load("../login.php");
	});
        
	ddsmoothmenu.init({
		mainmenuid: "top_nav", //menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu', //class added to menu's outer DIV
		//customtheme: ["#1c5a80", "#18374a"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	});
		
	//hover effects
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});

	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	
	//Diagnal Sliding
	$('.boxgrid.thecombo').hover(function(){
	$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
	});
	$( "#accordion" ).accordion({
		heightStyle: "content",
		
	});
	
		//cart system
	
	
	
});
  /*end of document*/
  
$(function() {

var brand = new String();
var model = new String();
var types =  new String();
var conditions =  new String();
var fuel =  new String();
var transmission =  new String();
var year = new String();

	$("#brand").change(function () {
			 brand = $(this).attr("value");
			var model="model";
			if(brand == "select"){
				brand=="";
			}
			
			$("#model").empty().load("../profile/selection.php?command="+model +"&modelid="+brand);
			//$("#carsearch").html(loader).load("shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		
		});
	$("#model").change(function () {
			 model = $(this).attr("value");
			if(model == ""){
				model=="";
			}
		//	alert(model);
				//$("#carsearch").html(loader).load("shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		});
	$("#types").change(function () {
			 types = $(this).attr("value");
			
			 
				//$("#carsearch").html(loader).load("shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		});
	$("#conditions").change(function () {
			 conditions = $(this).attr("value");
			
			 
				//$("#carsearch").html(loader).load("shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		});
	$("#fuel").change(function () {
			 fuel = $(this).attr("value");
			
			 
				//$("#carsearch").html(loader).load("shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		});
	$("#transmission").change(function () {
			 transmission = $(this).attr("value");
			
			 
			$("#carsearch").html(loader).load("../shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission);
		});
		
	$("#findcar").click(function() {
			brand = $("#brand").val();
			model = $("#model").val();
			types = $("#types").val();
			conditions = $("#conditions").val();
			fuel = $("#fuel").val();
			transmission = $("#transmission").val();
			year = $("#year").val();
			$("#carsearch").empty().html(loader).load("../shop/carsearch_ajax.php?brand="+brand+"&model="+model+"&types="+types+"&conditions="+conditions+"&fuel="+fuel+"&transmission="+transmission+"&year="+year);
		
		
	});


});
function add2cart(value){
var qty =1;
	
	
var command="add";
	$.ajax({
		url:"shop/cart.php?command="+command+"&itemId="+value+"&qty="+ qty,
		success:function(data){
			$("#itemList").slideDown('slow').html(loader).load("../shop/cartList.php");
		}		
	});
			
}

  
function deletecart(value){
var command = "delete";
var itemId = value;
$.ajax({
			url:"../shop/cart.php?command="+command+"&itemId="+itemId,
			success:function(data){
			
			$("#itemList").html(loader).load("../shop/cartList.php");
			
			}		
		})


}

function deleteallcart(){

	var command = "deleteall";
	if(confirm("Do you want to clear your cart?")){
	$.ajax({
				url:"../shop/cart.php?command="+command,
				success:function(data){
				
				$("#msgbox").html(data);
				$("#msgbox").dialog();
				$("#itemList").html(loader).load("../shop/cartList.php");
				
				}		
			})
	}
}

function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}
</script>